package com.u3k.mid;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.u3k.app.mid.utils.common.PathUtil;
import java.io.File;

class ao extends SQLiteOpenHelper {
    public ao(Context context) {
        super(context, PathUtil.getDatabaseDir(context) + File.separator + "u3kmid.db", null, 2);
    }

    public void onCreate(SQLiteDatabase sQLiteDatabase) {
        sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS modules_table (_id INTEGER PRIMARY KEY AUTOINCREMENT, libId INTEGER, libCrc32 LONG, libVersion VARCHAR, localLibVersion VARCHAR, libUrl VARCHAR, name VARCHAR, coreClass VARCHAR, baseCoreClass VARCHAR, publicApis VARCHAR, enable INTEGER)");
        sQLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS statistics_table (_id INTEGER PRIMARY KEY AUTOINCREMENT, moduleName VARCHAR, moduleVer VARCHAR, midVer VARCHAR, shellVer VARCHAR, appId VARCHAR, channelId VARCHAR, bundleId VARCHAR, userToken VARCHAR, event VARCHAR, data VARCHAR, time LONG)");
    }

    public void onOpen(SQLiteDatabase sQLiteDatabase) {
        super.onOpen(sQLiteDatabase);
    }

    public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
        if (i2 >= 2 && i == 1) {
            sQLiteDatabase.execSQL("DROP TABLE IF EXISTS modules_table");
            onCreate(sQLiteDatabase);
        }
    }
}
